Python: why does `random.randint(a, b)` return a range inclusive of `b`?

Posted by David Wolever on Stack Overflow See other posts from Stack Overflow or by David Wolever
Published on 2010-04-02T19:38:00Z Indexed on 2010/04/02 19:43 UTC
Read the original article Hit count: 240

Filed under:
|

It has always seemed strange to me that random.randint(a, b) would return an integer in the range [a, b], instead of [a, b-1] like range(...).

Is there any reason for this apparent inconsistency?

© Stack Overflow or respective owner

Related posts about python

Related posts about random